﻿<%@ Page Title="Polos" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="frmCadPolo.aspx.cs" Inherits="AcadPosApp.Cadastros.frmCadPolo" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style17
        {
            width: 307px;
        }
        .style22
        {
            width: 29%;
        }
        .style27
        {
            width: 17%;
        }
        .style31
        {
            width: 189px;
        }
        .style34
        {
            width: 12%;
        }
        .style35
        {
            width: 311px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Panel ID="pnlPesquisa" runat="server" GroupingText="Consulta de Polos por Estado">
        <table class="style1">
            <tr>
                <td class="style35">
                    Estado
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style35">
                    <asp:DropDownList ID="ddlEstadoPesquisa" runat="server" Width="150px" 
                        OnSelectedIndexChanged="ddlEstadoPesquisa_SelectedIndexChanged">
                    </asp:DropDownList>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style35">
                    Descrição
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style35">
                    <asp:TextBox ID="txtPesquisa" required 
                        pattern="[çÇùÙúÚôÔõÕòÒóÓìÌíÍêÊèÈéÉáÁàÀãÃâÂaA-zZ\s]+$" runat="server" 
                        MaxLength="150" Width="300px"></asp:TextBox>
                    <!--  <asp:TextBox ID="TextBox1" required pattern="[çÇùÙúÚôÔõÕòÒóÓìÌíÍêÊèÈéÉáÁàÀãÃâÂaA-zZ\s]+$" runat="server" Width="250px" MaxLength="50"></asp:TextBox>        
                     <asp:RequiredFieldValidator ID="requiredPesquisa" runat="server" ControlToValidate="txtPesquisa"
                        ErrorMessage="É necessário preencher o campo pesquisa!" ForeColor="Red" ValidationGroup="pesquisa"
                        SetFocusOnError="True">*</asp:RequiredFieldValidator>    -->
                </td>
                <td>
                    <asp:Button ID="btnConsultar" runat="server" Text="Consultar" ValidationGroup="pesquisa"
                         OnClick="btnConsultar_Click" Width="100px" />
                </td>                
            </tr>
        </table>
        <br />
        <asp:GridView ID="gvwPesquisa" runat="server" AutoGenerateColumns="False" CssClass="mGrid"
            DataKeyNames="ID_POLO" EmptyDataText="Dados não localizados..." GridLines="Vertical"
            OnRowCommand="gvwPesquisa_RowCommand" Width="40%" OnRowCreated="gvwPesquisa_RowCreated"
            OnRowDataBound="gvwPesquisa_RowDataBound" AllowPaging="True" 
            OnPageIndexChanging="gvwPesquisa_PageIndexChanging">
            <AlternatingRowStyle BackColor="#D3D3D3" />
            <Columns>
                <%--<asp:ButtonField ButtonType="Image" CommandName="Alterar" ImageUrl="~/Imagens/edit.png"
                    Text="Button" HeaderText="Alterar" >
                    <ItemStyle  Width="20px"/>
                    </asp:ButtonField>  --%>
                <asp:TemplateField HeaderText="Editar" ShowHeader="False">
                    <ItemTemplate>
                        <abbr>
                            <asp:ImageButton ID="ImgAlterar" runat="server" CausesValidation="false" CommandName="Alterar"
                                formnovalidate="formnovalidate" ImageUrl="~/Imagens/edit.png" Text="Alterar"
                                Width="20px" />
                        </abbr>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" Width="1%" />
                    <ItemStyle HorizontalAlign="Center" Width="1%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Excluir" ShowHeader="False">
                    <ItemTemplate>
                        <abbr title="Excluir">
                            <asp:ImageButton ID="Excluir" formnovalidate="formnovalidate" runat="server" CausesValidation="false"
                                OnClientClick="return ShowConfirm('Tem certeza que deseja excluir?', this.ID);"
                                CommandName="Excluir" ImageUrl="~/Imagens/delete.png" Text="Excluir" Width="20px" />
                        </abbr>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" Width="1%" />
                    <ItemStyle HorizontalAlign="Center" Width="1%" />
                </asp:TemplateField>
                <asp:BoundField DataField="ESTADO_POLO" HeaderText="Estado">
                    <ItemStyle Width="5%" HorizontalAlign="Center" />
                </asp:BoundField>
                <asp:BoundField DataField="DESCRICAO" HeaderText="Descrição">
                    <ItemStyle HorizontalAlign="Left" Width="65%" />
                </asp:BoundField>
                <asp:BoundField DataField="CIDADE" HeaderText="Cidade">
                    <ItemStyle HorizontalAlign="Center" Width="20%" />
                </asp:BoundField>
                <asp:TemplateField HeaderText="Status">
                    <ItemTemplate>
                        <asp:Image ID="imgStatus" runat="server" Height="25px" Width="25px" />
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" Width="1%" />
                    <ItemStyle HorizontalAlign="Center" Width="1%" />
                </asp:TemplateField>
                <asp:BoundField DataField="SITUACAO" HeaderText="Situação">
                    <ItemStyle Width="10%" HorizontalAlign="Center" />
                </asp:BoundField>
            </Columns>
            <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
            <PagerStyle CssClass="pagination" ForeColor="Black" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#1E90FF" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#808080" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#383838" />
        </asp:GridView>
        <br />
        &nbsp;&nbsp;
        <asp:Button ID="btnInserir" runat="server" Text="Inserir" OnClick="btnInserir_Click"
            formnovalidate="formnovalidate" Width="100px" /><br /><br />
    </asp:Panel>
    <br />
    <asp:Panel ID="pnlCadastro" runat="server" GroupingText="Cadastro de Polos por Estado"
        Visible="False">
        <table class="style1">
            <tr>
                <td colspan="2">
                    Estado
                    <br />
                    <asp:DropDownList ID="ddlCadEstado" runat="server" Width="150px">
                    </asp:DropDownList>
                </td>
                <td colspan="2">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    Descrição
                    <asp:TextBox ID="txtDescricao" runat="server" Height="30px" MaxLength="150" 
                        required="required" Width="400px" pattern="^((.)(?!\2{3,}))+$" title="Somente são permitidos 3 caracteres iguais e consecutivos.">
                    </asp:TextBox>
                </td>
                <td colspan="2">
                    &nbsp;</td>
            </tr>
            <tr>
                <td colspan="2">
                    Situação<br />
                    <asp:DropDownList ID="ddlSituacao" runat="server" Width="150px">
                        <asp:ListItem Value="A">Ativo</asp:ListItem>
                        <asp:ListItem Value="I">Inativo</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td colspan="2">
                    &nbsp;</td>
            </tr>
            <tr>
                <td colspan="4">
                    CEP
                    <!-- <asp:RegularExpressionValidator ID="revNumeros" runat="server" 
                        ControlToValidate="txtCEP" ErrorMessage="Para CEP, digite apenas números." 
                        ForeColor="Red" SetFocusOnError="True" ValidationExpression="^\d*$" 
                        ValidationGroup="consultaCEP" Visible="true">*</asp:RegularExpressionValidator> -->
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style34">
                    <asp:TextBox ID="txtCEP" required="required" runat="server" MaxLength="8" 
                        Width="150px"></asp:TextBox>
                    <!-- <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtCEP"
                        ErrorMessage="É necessário preencher o campo CEP!" ForeColor="Red" ValidationGroup="consultaCEP"
                        SetFocusOnError="True">*</asp:RequiredFieldValidator> -->
                    <%--<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtCEP"
                        ErrorMessage="Para CEP, digite apenas números." ForeColor="Red" ValidationExpression="^\d*$"
                        ValidationGroup="cadastro" SetFocusOnError="True" Visible="False">*</asp:RegularExpressionValidator>--%> 
                </td>
                <td class="style31">
                    <asp:Button ID="btnConsultarCEP" formnovalidate="formnovalidate" runat="server" Text="Consultar"
                        OnClick="btnConsultarCEP_Click" ValidationGroup="consultaCEP" 
                        Width="100px" />
                </td>
                <td colspan="2">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    Endereço
                </td>
                <td colspan="2">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="4">
                    <asp:TextBox ID="txtEndereco" required runat="server" MaxLength="200" 
                        Width="400px" pattern="^((.)(?!\2{3,}))+$" title="Somente são permitidos 3 caracteres iguais e consecutivos.">
                    </asp:TextBox>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style34">
                    Número<br />
                    <asp:TextBox ID="txtNumeroEndereco" runat="server" MaxLength="8" 
                        required="required" pattern="[0-9]" Title="Somente números." Width="150px"></asp:TextBox>
                    <!-- <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                        ControlToValidate="txtNumeroEndereco" 
                        ErrorMessage="Para Número, digite apenas números." ForeColor="Red" 
                        SetFocusOnError="True" ValidationExpression="^\d*$" ValidationGroup="cadastro" 
                        Visible="False">*</asp:RegularExpressionValidator> -->
                </td>
                <td colspan="3">
                    Complemento<br />
                    <asp:TextBox ID="txtComplemento" runat="server" MaxLength="200" 
                        Width="240px" pattern="^((.)(?!\2{3,}))+$" title="Somente são permitidos 3 caracteres iguais e consecutivos.">
                    </asp:TextBox>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    Bairro<br />
                    <asp:TextBox ID="txtBairro" runat="server" MaxLength="50" required="" 
                        Width="400px" pattern="^((.)(?!\2{3,}))+$" title="Somente são permitidos 3 caracteres iguais e consecutivos.">
                    </asp:TextBox>
                </td>
                <td colspan="2">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style34">
                    UF<br />
                    <asp:DropDownList ID="ddlUF" runat="server" Width="150px">
                    </asp:DropDownList>
                </td>
                <td colspan="3">
                    Cidade<br />
                    <asp:TextBox ID="txtCidadeUF" runat="server" MaxLength="50" 
                        required="" Width="240px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    E-mail  
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator12" 
                        runat="server" ControlToValidate="txtEmail" 
                        ErrorMessage="O campo email deve ser válido!" ForeColor="Red" 
                        ValidationExpression="^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$" 
                        ValidationGroup="cadastro">*</asp:RegularExpressionValidator>
                    <br />
                    <asp:TextBox ID="txtEmail" runat="server" Height="30px" MaxLength="150" 
                        required="" Width="400px" pattern="^((.)(?!\2{3,}))+$" title="Somente são permitidos 3 caracteres iguais e consecutivos.">
                    </asp:TextBox>
                </td>
                <td colspan="2">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="style34">
                    DDD<br />
                    <asp:TextBox ID="txtDDD1" runat="server" Height="30px" MaxLength="3" 
                        pattern="[0-9]+$" placeholder="0XX" required="" Width="148px"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" 
                        ControlToValidate="txtDDD1" ErrorMessage="Para DDD1, digite apenas números." 
                        ForeColor="Red" SetFocusOnError="True" ValidationExpression="^\d*$" 
                        ValidationGroup="cadastro" Visible="False">*</asp:RegularExpressionValidator>
                </td>
                <td class="style31">
                    Telefone<asp:RegularExpressionValidator ID="RegularExpressionValidator4" 
                        runat="server" ControlToValidate="txtTelefone" 
                        ErrorMessage="Para Telefone, digite apenas números." ForeColor="Red" 
                        SetFocusOnError="True" ValidationExpression="^\d*$" ValidationGroup="cadastro" 
                        Visible="False">*</asp:RegularExpressionValidator>
                    &nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:TextBox ID="txtTelefone" runat="server" Height="30px" MaxLength="9" 
                        name="phone" pattern="[0-9]{4,6}-[0-9]{3,4}$" placeholder="XXXX-XXXX" 
                        required="" Width="240px"></asp:TextBox>
                </td>
                <td class="style27">
                    &nbsp;</td>
                <td class="style22">
&nbsp;</td>
            </tr>
            <tr>
                <td class="style34">
                    DDD<br />
                    <asp:TextBox ID="txtDDD2" runat="server" Height="30px" MaxLength="3" 
                        pattern="[0-9]+$" placeholder="0XX" Width="148px"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" 
                        ControlToValidate="txtDDD2" ErrorMessage="Para DDD2, digite apenas números." 
                        ForeColor="Red" SetFocusOnError="True" ValidationExpression="^\d*$" 
                        ValidationGroup="cadastro" Visible="False">*</asp:RegularExpressionValidator>
                </td>
                <td class="style31">
                    Celular<br />
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator6" runat="server" 
                        ControlToValidate="txtCelular" 
                        ErrorMessage="Para Celular, digite apenas números." ForeColor="Red" 
                        SetFocusOnError="True" ValidationExpression="^\d*$" ValidationGroup="cadastro" 
                        Visible="False">*</asp:RegularExpressionValidator>
                    <asp:TextBox ID="txtCelular" runat="server" Height="30px" MaxLength="9" 
                        name="phone" pattern="[0-9]{4,6}-[0-9]{3,4}$" placeholder="XXXX-XXXX" 
                        Width="240px"></asp:TextBox>
                </td>
                <td class="style27">
                    &nbsp;</td>
                <td class="style22">
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style34">
                    Administrador do Polo<br />
                    <asp:TextBox ID="txtCadPesqAdmPolo" runat="server" MaxLength="50" Width="150px" required="required"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                        ControlToValidate="txtCadPesqAdmPolo" 
                        ErrorMessage="É necessário preencher o campo pesquisa!" ForeColor="Red" 
                        SetFocusOnError="True" ValidationGroup="consultaAdmPolo">*</asp:RequiredFieldValidator>
                </td>
                <td class="style31">
                    <asp:Button ID="btnConsultaAdmPolo" runat="server" 
                        formnovalidate="formnovalidate" OnClick="btnConsultaAdmPolo_Click" 
                        Text="Consultar" ValidationGroup="consultaAdmPolo" Width="100px" />
                </td><td>
                    &nbsp;</td><td></td>
            </tr>
            
        </table>
        <br />
        <asp:GridView ID="gvwAdmPolo" runat="server" AutoGenerateColumns="False" CssClass="mGrid"
            DataKeyNames="ID_ADMINISTRADOR" EmptyDataText="Dados não localizados..." GridLines="Vertical"
            Width="95%" OnPageIndexChanging="gvwAdmPolo_PageIndexChanging" PageSize="5" AllowPaging="True"
            OnSelectedIndexChanged="gvwAdmPolo_SelectedIndexChanged">
            <AlternatingRowStyle BackColor="#D3D3D3" />
            <Columns>
                <asp:CommandField ButtonType="Image" SelectImageUrl="~/Imagens/select.png" ShowSelectButton="True" />
                <asp:BoundField DataField="NOME" HeaderText="Nome">
                    <ItemStyle HorizontalAlign="Left" Width="99%" />
                </asp:BoundField>
            </Columns>
            <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
            <PagerStyle CssClass="pagination" ForeColor="Black" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#1E90FF" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#808080" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#383838" />
        </asp:GridView>
        <div class="legenda">
            <asp:Button ID="btnConfirmar" runat="server" Text="Confirmar"
                OnClick="btnConfirmar_Click" Width="100px" />
            &nbsp;
            <asp:Button ID="btnCancelar" formnovalidate="formnovalidate" runat="server" Text="Cancelar"
                OnClick="btnCancelar_Click" Width="100px" />
        </div><br />
    </asp:Panel>
    <asp:ValidationSummary ID="VSPesquisa" runat="server" ShowMessageBox="True" ShowSummary="False"
        ValidationGroup="pesquisa" />
    <asp:ValidationSummary ID="VSCadastro" runat="server" ShowMessageBox="True" ShowSummary="False"
        ValidationGroup="cadastro" />
    <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"
        ShowSummary="False" ValidationGroup="consultaCEP" />
    <asp:ValidationSummary ID="ValidationSummary2" runat="server" ShowMessageBox="True"
        ShowSummary="False" ValidationGroup="consultaAdmPolo" />
</asp:Content>
